home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Concept 6
/
CD Concept 06.iso
/
mac
/
UTILITAIRE
/
Little Smalltalk v3.1.4
/
C Source
/
Sources
/
Callbacks.c
next >
Wrap
Text File
|
1995-01-26
|
2KB
|
71 lines
/*
Little Smalltalk, version 3
Written by Tim Budd, Oregon State University, June 1988
Symantec Think Class Library interface code
⌐Julian Barkway, August 1994 , all rights reserved.
Callbacks.c
-----------
This is a set of callback routines, mainly for processing dialogs.
*/
#include "Callbacks.proto.h"
#include "LStResources.h"
//======================================================================================
// Highlight the default button by drawing a thick border around it.
//======================================================================================
pascal void highlightButton (DialogPtr dialog, short item)
{
short type;
Rect box;
Handle itemHdl;
GetDItem (dialog, kSetButtonID, &type, &itemHdl, &box);
PenSize (3, 3);
InsetRect (&box, -4, -4);
FrameRoundRect (&box, 16, 16);
PenNormal ();
}
//====================================================================================== DLOGfilterProc1 - called from inside of ModalDialog
// Process button 1 as default, button 2 as Cancel (allows Return, Enter and 'cmd .')
//======================================================================================
pascal Boolean defaultButtonFilter (DialogPtr dialog, EventRecord *event, short *item)
{
short type;
Rect box;
char c;
long endTicks;
Handle itemHndl;
c = (event->message & charCodeMask);
switch (c) {
case 13: // <Return> or <enter>
case 3:
*item = kSetButtonID;
break;
case '.': // <Cmd .>
if (event->modifiers & cmdKey)
*item = kCancelButtonID;
else
return false; // Just an ordinary dot. We're not interested.
break;
default:
return false; // Not what we're after so give up
}
GetDItem (dialog, *item, &type, &itemHndl, &box);
if (type == (ctrlItem | btnCtrl)) {
HiliteControl ((ControlHandle)itemHndl, true);
Delay (8, &endTicks);
HiliteControl ((ControlHandle)itemHndl, false);
}
event->what = mouseDown;
return true;
}